<template>
  <div id="detail">
    <!-- 导航栏 -->
    <detail-nav-bar></detail-nav-bar>
    <detail-swiper :topImages="topImages" />
  </div>
</template>

<script>
import DetailNavBar from "./childComps/DetailNavBar.vue";
import DetailSwiper from "./childComps/DetailSwiper.vue";

import { getDetail } from "../../api/detail/detail";

export default {
  name: "Detail",
  components: {
    DetailNavBar,
    DetailSwiper,
  },
  data() {
    return {
      iid: null /* 初始化id */,
      topImages: [] /* 轮播图数组对象 */,
    };
  },
  created() {
    //1. 返回点击图片的id
    this.iid = this.$route.params.iid;
    // 根据返回的id值查询数据
    getDetail(this.iid).then((res) => {
      this.topImages = res.result.itemInfo.topImages;
    });
  },

  methods: {},
};
</script>
<style scoped>
</style>